import { Navigate } from "react-router-dom";
import { lazy } from 'react'

var Conference = lazy(() => import('../../src/views/cjns/Conference/Conference.tsx'))
var Moneys = lazy(() => import('../../src/views/cjns/Moneys/Moneys.tsx'))
var NotFound = lazy(() => import('../../src/views/NotFound/NotFound.tsx'))

var Manage = lazy(() => import('../../src/views/cjns/Conference/Manage/Manage.tsx'))
var Record = lazy(() => import('../../src/views/cjns/Conference/Record/Record.tsx'))
var Archives = lazy(() => import('../../src/views/cjns/Moneys/Archives/Archives.tsx'))
var PaySlip = lazy(() => import('../../src/views/cjns/Moneys/PaySlip/PaySlip.tsx'))
var Salary = lazy(() => import('../../src/views/cjns/Moneys/Salary/Salary.tsx'))
var SetUp = lazy(() => import('../../src/views/cjns/Moneys/SetUp/SetUp.tsx'))

var Account = lazy(() => import('../../src/views/cjns/Moneys/Salary/Account/Account.tsx'))
var Group = lazy(() => import('../../src/views/cjns/Moneys/Salary/Group/Group.tsx'))
var Project = lazy(() => import('../../src/views/cjns/Moneys/Salary/Project/Project.tsx'))
var Field = lazy(() => import('../../src/views/cjns/Moneys/SetUp/Field/Field.tsx'))
var Setting = lazy(() => import('../../src/views/cjns/Moneys/SetUp/Setting/Setting.tsx'))


var AddMetting = lazy(() => import('../../src/views/cjns/Conference/AddMetting.tsx'))
var Reservation = lazy(() => import('../../src/views/cjns/Conference/Reservation.tsx'))
var AddAccount = lazy(() => import('../../src/views/cjns/Moneys/Salary/AddAccount.tsx'))
var AddGroup = lazy(() => import('../../src/views/cjns/Moneys/Salary/AddGroup'))
var AddProject = lazy(() => import('../../src/views/cjns/Moneys/Salary/AddProject'))

var router = [
    {
        path: '/index/conference',
        element: <Conference />,
        children: [
            {
                path: '/index/conference/manage',
                element: <Manage />,
            },
            {
                path: '/index/conference/manage/addmetting',
                element: <AddMetting />,
            },
            {
                path: '/index/conference/record',
                element: <Record />,
            },
            {
                path: '/index/conference/record/reservation',
                element: <Reservation />,
            },
            {
                path: '/index/conference',
                element: <Navigate to='/index/conference/manage' />,
            },
            {
                path: '*',
                element: <NotFound />,
            },
        ]
    },
    {
        path: '/index/moneys',
        element: <Moneys />,
        children: [
            {
                path: '/index/moneys/archives',
                element: <Archives />,
            },
            {
                path: '/index/moneys/payslip',
                element: <PaySlip />,
            },
            {
                path: '/index/moneys/salary',
                element: <Salary />,
                children: [
                    {
                        path: '/index/moneys/salary/account',
                        element: <Account />,
                    },
                    {
                        path: '/index/moneys/salary/addaccount',
                        element: <AddAccount />,
                    },
                    {
                        path: '/index/moneys/salary/group',
                        element: <Group />,
                    },
                    {
                        path: '/index/moneys/salary/addgroup',
                        element: <AddGroup />,
                    },
                    {
                        path: '/index/moneys/salary/project',
                        element: <Project />,
                    },
                    {
                        path: '/index/moneys/salary/addproject',
                        element: <AddProject />,
                    },
                    {
                        path: '/index/moneys/salary',
                        element: <Navigate to='/index/moneys/salary/account' />,
                    },
                    {
                        path: '*',
                        element: <NotFound />,
                    },
                ]
            },
            {
                path: '/index/moneys/setup',
                element: <SetUp />,
                children: [
                    {
                        path: '/index/moneys/setup/field',
                        element: <Field />,
                    },
                    {
                        path: '/index/moneys/setup/setting',
                        element: <Setting />,
                    },
                    {
                        path: '/index/moneys/setup',
                        element: <Navigate to='/index/moneys/setup/field' />,
                    },
                    {
                        path: '*',
                        element: <NotFound />,
                    },
                ]
            },
            {
                path: '/index/moneys',
                element: <Navigate to='/index/moneys/salary' />,
            },
            {
                path: '*',
                element: <NotFound />,
            },
        ]
    },
    {
        path: '/index',
        element: <Navigate to='/index/moneys' />,
    },
    {
        path: '*',
        element: <NotFound />,
    },
]
export default router;
